Skip to content

Conversation

@jack-edmonds-dd
Copy link
Contributor

What does this PR do?

Additional Notes

Review checklist

Please check relevant items below:

  • This PR includes all newly recorded cassettes for any modified tests.

  • This PR does not rely on API client schema changes.

    • The CI should be fully passing.
  • Or, this PR relies on API schema changes and this is a Draft PR to include tests for that new functionality.

    • Note: CI shouldn't be run on this Draft PR, as its expected to fail without the corresponding schema changes.

@jack-edmonds-dd jack-edmonds-dd requested review from a team as code owners April 17, 2025 18:53
return data if data.instance_of?(Hash)
when 'UUID'
return UUIDTools::UUID.parse(data)
raise TypeError, "Expected String, got #{uuid_string.class.name} instead." unless uuid_string.kind_of?(String)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Suggested change
raise TypeError, "Expected String, got #{uuid_string.class.name} instead." unless uuid_string.kind_of?(String)
raise TypeError, "Expected String, got #{uuid_string.class.name} instead." unless uuid_string.is_a?(String)
Prefer is_a? over kind_of? (...read more)

The rule "Prefer is_a? over kind_of?" suggests to use the method is_a? instead of kind_of? in your Ruby code. Both is_a? and kind_of? methods check if an object is an instance of a class or its subclasses. However, is_a? is generally preferred due to its clear and concise terminology.

This rule is important for maintaining consistency and readability in your code. Using is_a? makes your code more understandable to other developers because its function is immediately apparent from its name. On the other hand, kind_of? might lead to confusion as it's not as clear in its function.

To avoid this rule violation, always use the is_a? method when you want to check the class of an object. For example, instead of writing something.kind_of?(Array), you should write something.is_a?(Array). This will make your code easier to read and understand, leading to better maintainability and fewer bugs.

View in Datadog  Leave us feedback  Documentation

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Apr 17, 2025

Datadog Report

Branch report: run-tests
Commit report: ad12c73
Test service: datadog-api-client-ruby

✅ 0 Failed, 1052 Passed, 2137 Skipped, 1m 50.81s Total duration (1m 17.75s time saved)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants